import { mergeConfig } from 'vite';
import eslint from 'vite-plugin-eslint';
import baseConfig from './vite.config.base';

export default mergeConfig(
  {
    mode: 'development',
    server: {
      host: '0.0.0.0',
      port: 9001,
      open: true,
      fs: {
        strict: true,
      },
      // proxy代理
      proxy: {
        '/api': {
          target: 'http://procurement.internal.avicnet.cn:32101',
          changeOrigin: true,
          // rewrite: (path: string) => path.replace(/^\/api/, ''),
        },
        '/aps': {
          // target: 'http://192.168.150.221:8080', // 张鹏
          target: 'http://192.168.151.49:8080', // 刘勇
          // target: 'http://194.194.7.162:8080', // 刘超
          changeOrigin: true,
          rewrite: (path: string) => path.replace(/^\//, ''),
        },
      },
    },
    plugins: [
      eslint({
        cache: false,
        include: ['src/**/*.ts', 'src/**/*.tsx', 'src/**/*.vue'],
        exclude: ['node_modules'],
      }),
    ],
  },
  baseConfig
);
